package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	FlowingEventNew           = "flow.FlowingNew"
	FlowingEventBeforeCreate  = "flow.FlowingBeforeCreate"
	FlowingEventBeforeUpdate  = "flow.FlowingBeforeUpdate"
	FlowingEventBeforeSave    = "flow.FlowingBeforeCreate flow.FlowingBeforeUpdate"
	FlowingEventAfterCreate   = "flow.FlowingAfterCreate"
	FlowingEventAfterUpdate   = "flow.FlowingAfterUpdate"
	FlowingEventAfterSave     = "flow.FlowingAfterCreate flow.FlowingAfterUpdate"
	FlowingEventDelete        = "flow.FlowingDelete"
	FlowingAccessControlEvent = "flow.FlowingAccessControl"
)

func GetFlowingConfig() *mgo.DocConfig {
	return Flowing_Config
}

var Flowing_Config *mgo.DocConfig

func init() {
	Flowing_Config = NewFlowingConfig()
}
func NewFlowingConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "flow.Flowing",
		Fields: []string{
			"title", "targetId", "targetType", "flow", "index", "flowCur", "flows", "state", "owner", "isConfirm", "confirmAt", "isCancel",
		},
		RelationFields: []string{
			"flow",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"flow": {
				Config:     GetFlowConfig,
				DocName:    "Flow",
				JoinType:   "O",
				KeyInside:  "flowId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
